/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package SRD.util;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import net.n3.nanoxml.*;

/**
 *
 * @author ylopez
 */
public class pruebaXML {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, FileNotFoundException, IOException, XMLException {
//        String epa = "<Messages protocol= \"PSRD\" version= \"1.0\" action= \"replyDrepDisconnect\">" +
//                        "<status>OK</status>" +
//                    "</Messages>";
//        IXMLParser parser;
//        parser = XMLParserFactory.createDefaultXMLParser();
//        IXMLReader reader;
//        reader = StdXMLReader.stringReader(epa);
//        parser.setReader(reader);
//        IXMLElement xml = (IXMLElement) parser.parse();
//        XMLWriter writer = new XMLWriter(System.out);
//        writer.write(xml);
//        System.out.println();
//        IXMLElement element = (IXMLElement) xml.getChildrenNamed("status").firstElement();
//        System.out.println("dfdf: " + xml.getAttributes().getProperty("protocol"));

//        FileReader fr;
//            BufferedReader bf;
//            String line = "";
//            String text = "";
//
//            fr = new FileReader("protocolo.txt");
//            bf = new BufferedReader(fr);
//
//            while ((line = bf.readLine())!=null) {
//                text += line + "\n";
//            }
//
//            System.out.println(text);
        try{
    // Create file
    FileWriter fstream = new FileWriter("out.txt");
        BufferedWriter out = new BufferedWriter(fstream);
    out.write("Hello Java");
    //Close the output stream
    out.close();
    }catch (Exception e){//Catch exception if any
      System.err.println("Error: " + e.getMessage());
    }
    }

}
